package com.qinggeng.project.system.service.impl;

import com.qinggeng.project.system.domain.DeviceBindPhone;
import com.qinggeng.project.system.mapper.DeviceBindPhoneMapper;
import com.qinggeng.project.system.service.DeviceBindPhoneService;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import javax.annotation.Resource;

@Service
public class DeviceBindPhoneServiceImpl implements DeviceBindPhoneService {
    @Resource
    private DeviceBindPhoneMapper deviceBindPhoneMapper;

    @Override
    public boolean checkBindDeviceNo(String deviceNo) {
        Example example = new Example(DeviceBindPhone.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("deviceNo",deviceNo);
        DeviceBindPhone deviceBindPhone = deviceBindPhoneMapper.selectOneByExample(example);
        if (deviceBindPhone!=null){
            return true;
        }
        return false;
    }

    @Override
    public boolean insertDeviceBindPhone(DeviceBindPhone deviceBindPhone) {
        int i = deviceBindPhoneMapper.insertSelective(deviceBindPhone);
        if ( i != 1){
            return false;
        }
        return true;
    }
}
